﻿

#region License
/*
 *  Copyright (c) Dumuzi.cn 2009 , All rights reserved.
 *  CLR Version: 2.0.50727.4927
 *  NameSpace: Summer.Core.Ioc
 *  Author:Edwin Tai,戴佳顺
 *  Msn:edwin19861218@hotmail.com
 *  QQ: 1961218
 *  Date:2009-11-06 15:08:56
 *  Licensed under the Microsoft Public License (Ms-PL)
 *  This license governs use of the accompanying software. 
 *  If you use the software, you accept this license.
 *  If you do not accept the license, do not use the software.
 */
#endregion

namespace Summer.Core.Ioc
{
    /// <summary>
    /// Entry context in container
    /// </summary>
    public class Context : AbstractContextContainer<IContextObject>
    {        
        /// <summary>
        /// Context name
        /// </summary>
        private string m_name = "SmartContext";
        /// <summary>
        /// Constructor without name
        /// </summary>
        public Context() { }
        /// <summary>
        /// Constructor with name
        /// </summary>
        /// <param name="name"></param>
        public Context(string name)
        {
            this.m_name = name;
        }
        /// <summary>
        /// Override the name of container
        /// </summary>
        public override string Name
        {
            get
            {
                return this.m_name;
            }
            set
            {
                this.m_name = value;
            }
        }

        public new IContextObject this[string key]
        {
            get
            {
                IContextObject obj=base[key];
                if (obj == null) { return null; }
                ContextManager.SetObjectInContextObject(obj, this);
                return obj;
            }
            set
            {
                base[key] = value;
            }
        }
        public override bool Load(object additional)
        {
            return base.Load(additional);
        }
        public override bool UnLoad()
        {
            return base.UnLoad();
        }

       

    }
}
